﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Utilities;
using Tokenization;

namespace WordDemo2
{
    public partial class TestRules : Form
    {
        public TestRules()
        {
            InitializeComponent();
        }

        private void btnRun_Click(object sender, EventArgs e)
        {
            
            if (ckbRuleFile.Checked)
            {
                Tokenizer tr = new Tokenizer();
                if (txtPIn.Text!="")
                {
                    tr.loadRules(txtPIn.Text);
                    txtOut.Text = tr.Process(txtIn.Text);
                }
                if (txtPOut.Text != "")
                {
                    tr.loadRules(txtPOut.Text);
                    txtOut.Text = tr.Process(txtOut.Text);
                }
            }
            else
            {
                Rule r = new Rule(txtPIn.Text, txtPOut.Text, txtP.Text);
                if (ckbMode.Checked)
                    txtOut.Text = r.ReplacePatternS(txtIn.Text);
                else
                    txtOut.Text = r.ReplacePattern(txtIn.Text);
            }
            
            //Debugger.createLog("Process1");
            //Debugger.showLog(true);
            //DataTraining.WordDistance wd = new DataTraining.WordDistance();
            //wd.process(txtPIn.Text, txtPOut.Text);
        }
    }
}
